Open
Conversation
KubEF
reviewed
Oct 18, 2025
| arr[i], arr[j] = arr[j], arr[i] | ||
|
|
||
|
|
||
| def sift_down(arr, i, upper): |
src/heapsort.py
Outdated
|
|
||
| def sift_down(arr, i, upper): | ||
| while True: | ||
| L, r = i * 2 + 1, i * 2 + 2 |
Collaborator
There was a problem hiding this comment.
Почему L с заглавной? И почему она назвается одной буквой?
Comment on lines
+39
to
+61
| def test_heapsort_sample_list(sample_list): | ||
| arr = sample_list.copy() | ||
| heapsort(arr) | ||
| assert arr == sorted(sample_list) | ||
|
|
||
|
|
||
| def test_heapsort_many_duplicates(many_duplicates): | ||
| arr = many_duplicates.copy() | ||
| heapsort(arr) | ||
| assert arr == sorted(many_duplicates) | ||
|
|
||
|
|
||
| def test_heapsort_cases(case_list): | ||
| arr = list(case_list) | ||
| heapsort(arr) | ||
| assert arr == sorted(case_list) | ||
|
|
||
|
|
||
| def test_heapsort_random(random_list): | ||
| a = random_list.copy() | ||
| b = list(a) | ||
| heapsort(b) | ||
| assert b == sorted(a) |
Collaborator
There was a problem hiding this comment.
У вас точно эти тесты работают? Вы же не импортировали conftest
KubEF
reviewed
Dec 15, 2025
| if arr[L] > arr[i]: | ||
| swap(arr, i, L) | ||
| i = L | ||
| lef, rig = i * 2 + 1, i * 2 + 2 |
Collaborator
There was a problem hiding this comment.
Почему не назвать честно left и right?
KubEF
approved these changes
Dec 15, 2025
Collaborator
|
Чтобы резрешили влить, нажмите "resolve conversation" у комментариев |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.